home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 2.iso
/
toolbox
/
perfTuning
/
XandSysPerf
/
xprotostats
< prev
next >
Wrap
Text File
|
1996-11-11
|
7KB
|
249 lines
#!/bin/sh
#
# xprotostats - an xscope protocol trace groaker
# Mark Kilgard
# 11/5/93
#
# XXX grep out the X ResourceDB since it is too long for awk
grep -v "value:" | awk '
# single-client Client IO case
NF == 5 && $2 == "Client" {
client_batches++
client_bytes += $4
}
# multi-client Client IO case
NF == 6 && $2 == "Client" {
client_batches++
client_bytes += $5
}
# request gotten
NF == 2 && $1 == "............REQUEST:" {
client_requests++
# try looking for dubious round-trip requests
if ($2 == "AllocColor") {
AllocColor++;
} else
if ($2 == "AllocColorCells") {
AllocColorCells++;
} else
if ($2 == "AllocColorPlanes") {
AllocColorPlanes++;
} else
if ($2 == "AllocNamedColor") {
AllocNamedColor++
} else
if ($2 == "ClearArea") {
ClearArea++
} else
if ($2 == "GetAtomName") {
GetAtomName++
} else
if ($2 == "GetFontPath") {
GetFontPath++
} else
if ($2 == "GetGeometry") {
GetGeometry++
} else
if ($2 == "GetInputFocus") {
GetInputFocus++
} else
if ($2 == "GetKeyboardMapping") {
GetKeyboardMapping++
} else
if ($2 == "GetModifierMapping") {
GetModifierMapping++
} else
if ($2 == "GetPointerMapping") {
GetPointerMapping++
} else
if ($2 == "GetSelectionOwner") {
GetSelectionOwner++
} else
if ($2 == "GetWindowAttributes") {
GetWindowAttributes++
} else
if ($2 == "InternAtom") {
InternAtom++
} else
if ($2 == "ListFonts") {
ListFonts++
} else
if ($2 == "ListProperties") {
ListProperties++
} else
if ($2 == "QueryBestSize") {
QueryBestSize++
} else
if ($2 == "QueryColors") {
QueryColors++
} else
if ($2 == "QueryExtension") {
QueryExtension++
} else
if ($2 == "QueryFont") {
QueryFont++
} else
if ($2 == "QueryKeymap") {
QueryKeymap++
} else
if ($2 == "QueryPointer") {
QueryPointer++
} else
if ($2 == "QueryTextExtents") {
QueryTextExtents++
} else
if ($2 == "QueryTree") {
QueryTree++
} else
if ($2 == "TranslateCoordinates") {
TranslateCoordinates++
}
}
# extension request gotten
NF == 4 && $1 == "#######" && $3 == "request" {
client_requests++
}
# extension event gotten
NF == 4 && $1 == "#######" && $3 == "Event" {
server_events++
}
# extension reply gotten
NF == 3 && $1 == "#######" && $3 == "reply" {
server_replies++
}
# single-client Server IO case
NF == 6 && $5 == "X11" && $6 == "Server" {
server_batches++
server_bytes += $2
}
# multi-client Server IO case
NF == 7 && $5 == "X11" && $6 == "Server" {
server_batches++
server_bytes += $2
}
# reply gotten
NF == 2 && $1 == "..............REPLY:" {
server_replies++
}
# event gotten
NF == 2 && $1 == "..............EVENT:" {
server_events++
# try looking for dubious events requests
if ($2 == "NoExposure") {
NoExposure++;
} else
if ($2 == "SendMessage") {
NoExposure++;
} else
if ($2 == "PropertyNotify") {
NoExposure++;
}
}
# error gotten
NF == 2 && $1 == "..............ERROR:" {
server_events++
}
END {
print
print "RAW CLIENT PROTOCOL STATISITICS:"
printf(" bytes written: %10d\n", client_bytes)
printf(" batches written: %10d\n", client_batches)
printf(" requests made: %10d\n", client_requests)
print "RAW SERVER PROTOCOL STATISITICS:"
printf(" bytes written: %10d\n", server_bytes)
printf(" batches written: %10d\n", server_batches)
printf(" replies made: %10d\n", server_replies)
printf(" events sent: %10d\n", server_events)
printf(" errors sent: %10d\n", server_errors)
print "COMPUTED STATISTICS:"
if (client_requests != 0)
printf(" replies/request: %6.2f %%\n", server_replies/client_requests*100.0)
else
printf(" replies/request: n/a\n")
if (client_bytes != 0)
printf(" server/client data: %6.2f %%\n", server_bytes/client_bytes*100.0)
else
printf(" server/client data: n/a\n")
if (client_requests != 0)
printf(" bytes/request: %6.2f bytes\n", client_bytes/client_requests)
else
printf(" bytes/request: n/a\n")
print "OFTEN MISUSED ROUND-TRIP REQUESTS:"
if(AllocColor > 0)
printf(" AllocColor %8d\n", AllocColor)
if(AllocColorCells > 0)
printf(" AllocColorCells %8d\n", AllocColorCells)
if(AllocColorPlanes > 0)
printf(" AllocColorPlanes %8d\n", AllocColorPlanes)
if(AllocNamedColor > 0)
printf(" AllocNamedColor %8d\n", AllocNamedColor)
if(GetAtomName > 0)
printf(" GetAtomName %8d\n", GetAtomName)
if(GetFontPath > 0)
printf(" GetFontPath %8d\n", GetFontPath)
if(GetGeometry > 0)
printf(" GetGeometry %8d\n", GetGeometry)
if(GetInputFocus > 0)
printf(" GetInputFocus %8d\n", GetInputFocus)
if(GetKeyboardMapping > 0)
printf(" GetKeyboardMapping %8d\n", GetKeyboardMapping)
if(GetModifierMapping > 0)
printf(" GetModifierMapping %8d\n", GetModifierMapping)
if(GetPointerMapping > 0)
printf(" GetPointerMapping %8d\n", GetPointerMapping)
if(GetSelectionOwner > 0)
printf(" GetSelectionOwner %8d\n", GetSelectionOwner)
if(GetWindowAttributes > 0)
printf(" GetWindowAttributes %8d\n", GetWindowAttributes)
if(InternAtom > 0)
printf(" InternAtom %8d\n", InternAtom)
if(ListFonts > 0)
printf(" ListFonts %8d\n", ListFonts)
if(ListProperties > 0)
printf(" ListProperties %8d\n", ListProperties)
if(QueryBestSize > 0)
printf(" QueryBestSize %8d\n", QueryBestSize)
if(QueryColors > 0)
printf(" QueryColors %8d\n", QueryColors)
if(QueryExtension > 0)
printf(" QueryExtension %8d\n", QueryExtension)
if(QueryFont > 0)
printf(" QueryFont %8d\n", QueryFont)
if(QueryKeymap > 0)
printf(" QueryKeymap %8d\n", QueryKeymap)
if(QueryPointer > 0)
printf(" QueryPointer %8d\n", QueryPointer)
if(QueryTextExtents > 0)
printf(" QueryTextExtents %8d\n", QueryTextExtents)
if(QueryTree > 0)
printf(" QueryTree %8d\n", QueryTree)
if(TranslateCoordinates > 0)
printf(" TranslateCoordinates %8d\n", TranslateCoordinates)
print "OFTEN MISUSED NON-ROUND-TRIP REQUESTS:"
if(ClearArea > 0)
printf(" ClearArea %8d\n", ClearArea)
print "OFTEN MISUSED EVENTS:"
if(ClientMessage > 0)
printf(" ClientMessage %8d\n", ClientMessage)
if(NoExposure > 0)
printf(" NoExposure %8d\n", NoExposure)
if(PropertyNotify > 0)
printf(" PropertyNotify %8d\n", PropertyNotify)
print
}' -